package com.itheima.chap02;

public class JoinDemo {
    public static void main(String[] args) {
        String s1 = "Hello";
        String s2 = "World";
        String s3 = "HelloWorld";
        String s4 = "Hello" + "World";
        String s5 = s1 + s2;

        System.out.println(s3 == s4); // true
        System.out.println(s3 == s5); // false
        System.out.println(s4 == s5); // false

        String[] names = {"小美", "小王", "小李"};

        System.out.println(String.join(",", names));

        int[] nums = {10, 20, 30, 40, 50};
        StringBuilder sb = new StringBuilder("[");
//        sb.append('[');
        for (int i = 0; i < nums.length; i++) {
            sb.append(nums[i]).append(',').append(' ');
        }
        sb.delete( sb.length() - 2,sb.length());
        sb.append(']');
        System.out.println(sb);
    }
}
